package com.sx.manage.controller.consumer;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.consumer.IMConsumerEditInfoService;
import com.sx.manage.service.consumer.MPersonConsumerEditWebServiceImpl;
import com.sx.manage.servlet.ViewAndModel;
import com.sx.model.constants.type.consumer.MConsumerEditAuth;
import com.sx.model.constants.type.consumer.MInfoEditApplyStatus;
import com.sx.model.manage.mybatis.form.consumer.MConsumerEditLogForm;
import com.sx.model.manage.mybatis.form.consumer.edit.MConsumerEditLogDetailForm;
import com.sx.model.manage.mybatis.vo.consumer.MConsumerEditDetailVO;
import com.sx.model.manage.mybatis.vo.consumer.MConsumerEditVO;
import com.sx.model.manage.mybatis.vo.result.ResultBooleanVO;
import com.sx.model.manage.mybatis.vo.result.ResultListVO;

/**
 * 个人用户信息修改
 * 
 * @author lenovo
 *
 */
@Controller
@RequestMapping("/consumerEdit")
public class MConsumerEditInfoController extends MBaseController {
	/**
	 * 日志
	 */
	private Logger log = LoggerFactory.getLogger(this.getClass());
	// 用户信息修改Web端service
	@Resource
	private MPersonConsumerEditWebServiceImpl personConsumerEditWebServiceImpl;
	// 用户信息修改
	@Resource
	private IMConsumerEditInfoService consumerEditInfoServiceImpl;
	/***
	 * 用户修改申请列表
	 * 
	 * @param editVO
	 * @param start
	 * @param length
	 * @return
	 */
	@RequestMapping(value = "examinePage")
	@ResponseBody
	public ResultListVO<MConsumerEditVO> examinePage(MConsumerEditLogForm form) {
		log.info("用户申请信息修改列表form={}",form);
		return this.consumerEditInfoServiceImpl.get_consumer_page(form);
	}

	/**
	 * 华夏信息审核列表
	 * 
	 * @param form
	 * @return
	 */
	@RequestMapping(value = "examinePageHuaXia")
	@ResponseBody
	public ResultListVO<MConsumerEditVO> examinePageHuaXia(MConsumerEditLogForm form) {
		log.info("用户申请信息修改列表form={}",form);
		form.setData_authority(MConsumerEditAuth.BANK_CONUSMER_AUTH);
		return this.consumerEditInfoServiceImpl.get_consumer_page(form);
	}

	/** 获取模块信息列表 */
	@RequestMapping(value = "inforConsumerLookForHuaXia")
	public ViewAndModel inforConsumerLookForHuaXia() {
		ViewAndModel view_ = new ViewAndModel(request, cache);
		view_.setViewName("huaXiaApp/customerView/inforLook");// customerView
		return view_;
	}
	/**
	 * 用户修改列表界面
	 * 
	 * @return
	 */
	@RequestMapping(value = "editInfoDetailForHuaXia/data")
	@ResponseBody
	public ResultListVO<MConsumerEditDetailVO> editInfoDetailForHuaXiaData(MConsumerEditLogDetailForm form) {
		log.info(" 用户修改列表界面数据列表form={}",form);
		return personConsumerEditWebServiceImpl.editInfoDetailForHuaXiaData(form);
	}
	/**
	 * 用户修改列表界面
	 * 
	 * @return
	 */
	@RequestMapping(value = "editInfoDetail/{id}")
	public ViewAndModel editInfoDetail(@PathVariable Long id) {
		log.info(" 用户修改列详细信息id={}",id);
		return personConsumerEditWebServiceImpl.editInfoDetail(id, new ViewAndModel(request, cache));
	}

	/**
	 * 用户修改列表界面
	 * 
	 * @return
	 */
	@RequestMapping(value = "editInfoDetail/data")
	@ResponseBody
	public ResultListVO<MConsumerEditDetailVO> editInfoDetailData(MConsumerEditLogDetailForm form) {
		log.info("用户修改详细信息列表数据form{}",form);
		return personConsumerEditWebServiceImpl.editInfoDetailData(form);
	}

	/**
	 * 用户修改列表界面
	 * 
	 * @return
	 */
	@RequestMapping(value = "inforConsumerLook")
	public ViewAndModel inforConsumerLook() {
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/auditing/inforLook");
		return model;
	}

	/**
	 * 系统用户审核
	 * 
	 * @param MPersonalConsumerVO
	 * @return
	 */
	@RequestMapping(value = "auditingConsumerEditStatus")
	@ResponseBody
	public ResultBooleanVO auditingConsumerEditStatus(MConsumerEditLogDetailForm detailForm) {
		log.info("系统用户审核detailForm={}",detailForm);
		return personConsumerEditWebServiceImpl.consumer_edit_status(detailForm, loginConsumer());
	}
	/**
	 * 华夏审核
	 * 
	 * @param MPersonalConsumerVO
	 * @return
	 */
	@RequestMapping(value = "auditingConsumerEditStatus/forHuaxia")
	@ResponseBody
	public ResultBooleanVO auditingConsumerEditStatusForHuaxia(Long detail_id, MInfoEditApplyStatus status) {
		log.info("系统用户审核detail_id={},status={}",detail_id,status);
		return personConsumerEditWebServiceImpl.consumer_edit_status_for_huaxia(detail_id, status, loginConsumer());
	}

}
